<?php
defined( '_JEXEC' ) or die( 'Restricted access' );
$template = $this->template;
$config = JFactory::getConfig();
$live_site = $config->getValue('live_site','').'/';
$js_path = $live_site.'templates/'.$template.'/js/';
$css_path = $live_site.'templates/'.$template.'/css/';
$sifr_css = $live_site.'sifr/css/';
$sifr_js = $live_site.'sifr/js/';
$sifr_flash = $live_site.'sifr/flash/';
$tmpl_images = $live_site.'templates/'.$template.'/images/';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language;?>" 
	lang="<?php echo $this->language; ?>" >

<head>
	<jdoc:include type="head" />
	<?php
		JHTML::_( 'behavior.mootools' );
		JHTML::_( 'behavior.modal' );
		JDocument::addScript( $js_path.'resolution.js', "text/Javascript" );
		JDocument::addScript( $js_path.'curvyCorners.js', "text/Javascript" );
		JDocument::addScript( $sifr_js.'sifr.js', "text/Javascript" );
		JDocument::addScript( $sifr_js.'sifr-config.js', 'text/Javascript' );
		//JDocument::addScript( $js_path. 'jquery.js', 'text/Javascript' );
		//JDocument::addScript( $js_path. 'equalHeights.js', 'text/Javascript' );
		//JDocument::addScript( $js_path. 'jquery.defaultvalue.js', 'text/Javascript' );	
	?>
	<script language = "Javascript">
		//jQuery.noConflict();
		checkCookie();
		window.onload = function()
 		{
      		settings = {
      		tl: false,
      		tr: { radius: 20 },
      		bl: false,
      		br: false,
      		antiAlias: true,
      		autoPad: false
    		}

    		var divObj = document.getElementById("content_box");

    		var cornersObj = new curvyCorners(settings, divObj);
    		cornersObj.applyCornersToAll();
  		}
		
	</script>

	<?php 
		//JHTML::stylesheet( 'reset.css', $css_path );
		
    	// The resolution cookie is set in javascript and set in php JUST IN CASE there is a future need for it
		if( isset( $_COOKIE["users_resolution"] ) && isset( $_COOKIE["users_width"] ) )
		{
			$res = $_COOKIE["users_resolution"];
			$width = (integer) $_COOKIE["users_width"];
			if( $width == 800 )
				JHTML::stylesheet( 'traffic800.css', $css_path );
			else
				include('browserdetection.php');
				switch( $browser) 
				{
					case 'Safari':
						JHTML::stylesheet( 'traffic.css', $css_path );
						JHTML::stylesheet( 'trafficsafari.css', $css_path );
						break;
					case 'IE':
						JHTML::stylesheet( 'traffic.css', $css_path );
						JHTML::stylesheet( 'trafficie7.css', $css_path );
						break;
					case 'Opera':
						JHTML::stylesheet( 'traffic.css', $css_path );
						JHTML::stylesheet( 'trafficopera.css', $css_path );
					default:
						JHTML::stylesheet( 'traffic.css', $css_path );
						break;
				}
		}
		
		JHTML::stylesheet( 'sIFR-print.css', $sifr_css, array( 'media'=>'print' ) );
		JHTML::stylesheet( 'sIFR-screen.css', $sifr_css, array( 'media'=>'screen' ) );
	?>
	
</head>

<body>

	<div id = "header">

		<?php
			// Which logo to use? Unless it's the BookKids page, load the default logo.
			if( $option == 'com_bookkids' )
			{
				$alt = 'BookKids logo';
				echo '<a href = "'.$live_site.'index.php?option=com_bookkids">' . 
					JHTML::image( $tmpl_images.'bkbiglogo.png', $alt, array( 'id'=>'logo' ) ).'</a>';
			}
			else
			{
				$alt = 'BookPeople logo';
				echo '<a href = "'.$live_site.'index.php">' . 
					JHTML::image( $tmpl_images.'bpbiglogo.png', $alt, array( 'id'=>'logo' ) ).'</a>';
			}
		?>
		
		<p id = "support">
			<a href = "#">Need help?</a>
		</p>
		
		<jdoc:include type="modules" name="search" style="xhtml" />
		
		<p id = "date"><?php echo date( 'j M' ); ?></p>
		
	</div>
	
	<div id = "navigation1">
		<jdoc:include type="modules" name="top" style="xhtml" />
	</div>
	
	<div id = "navigation2">
		<jdoc:include type="modules" name="user1" style="xhtml" />
	</div>
	
	<div id = "content_box">
		<!--<jdoc:include type="modules" name="breadcrumb" style="xhtml" />-->
		
		<?php
			/* This decides which page is going to be displayed, based on the $option variable.
			   So far, only BookKids has its own (blank) component. All others (again, thus far)
			   can be successfully displayed with the com_content.php file. */
			switch( $option )
			{
				case 'com_bookkids':
					include( 'com_bookkids.php' );
					break;
				case 'com_eventlist':
				case 'com_content':
				default:
					include( 'com_content.php' );
					break;
			}
			
			echo $option;
		?>
	
	</div>

	<div id = "footer">
		
		<jdoc:include type="modules" name="footer" style="xhtml" />
		
		<span class = "copyright">&copy; BookPeople 2008</span>
		
		<div class = "clear"></div>
		
	</div>
	
</body>

</html>